package com.itlong.cloud.miniprogram.resource;

import com.itlong.cloud.POJO.DTO.smartcard.SmartCardQRCodeContentDTO;
import com.itlong.cloud.miniprogram.service.IMiniProgramPushMessageService;
import com.itlong.cloud.noncore.miniprogram.IMiniProgramPushMessageServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      小程序推送数据业务处理接口暴露实现类
 * </desc>
 *
 * @createDate2021/5/31
 **/
@RestController
public class MiniProgramPushMessageServiceResource implements IMiniProgramPushMessageServiceClient {

    @Autowired
    private IMiniProgramPushMessageService iMiniProgramPushMessageService;

    /**
     * <desc>
     *      推送小程序消息
     * </desc>
     *
     * @param
     * @return
     * @Author Zhu.yj
     * @createDate  2021/5/31
     */
    @Override
    @RequestMapping("/miniProgram/pushMessage")
    public void pushMessage(@RequestParam("visitorId") String visitorId) throws Exception {
        iMiniProgramPushMessageService.pushMessage(visitorId);
    }


    /**
     * <desc>
     *      将线下平台传入访客二维码信息存入缓存
     * </desc>
     *
     * @param cardQRCodeContentDTO 访客二维码信息
     * @return
     * @Author Zhu.yj
     * @createDate  2021/6/3
     */
    @RequestMapping("cacheVisitor")
    @Override
    public void cacheVisitor(@RequestBody SmartCardQRCodeContentDTO cardQRCodeContentDTO) throws Exception {
        iMiniProgramPushMessageService.cacheVisitor(cardQRCodeContentDTO);
    }
}
